function [node, elem, bdary] = processing_node_elem_bdary_1d(a, b, N, basis_type, boundary_type)

node = linspace(a, b, N+1);
elem = [(1:N)', (2:N+1)'];

switch basis_type
    case "P1"

    case {"P1b", "P2"}
        newpoints = (node(1:end-1) + node(2:end)) / 2;
        node = [node, newpoints];
        elem = [elem, (N+2:2*N+1)'];

    case "P3"
        newpoints = reshape(node(1:end-1) + (1:2).' * (node(2:end) - node(1:end-1)) / 3, 1, []);
        node = [node, newpoints];
        elem = [elem, reshape((N+2):(3*N+1), 2, N)'];

    case "P4"
        newpoints = reshape(node(1:end-1) + (1:3).' * (node(2:end) - node(1:end-1)) / 4, 1, []);
        node = [node, newpoints];
        elem = [elem, reshape((N+2):(4*N+1), 3, N)'];

    otherwise
        error("Invalid basis type");
end

switch boundary_type
    case "Dirichlet"
        bdary = [0, 0;
            1,N+1];

    case "NeumanLeft"
        bdary = [2, 0;
            1,N+1;
            -1, 0];

    case "NeumanRight"
        bdary = [0, 2;
            1,N+1;
            0, 1];

    case "Robin"

    otherwise
        error("Invalid boundary type");
end


end